package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	InquiryFeedbackEventNew           = "erp.InquiryFeedbackNew"
	InquiryFeedbackEventBeforeCreate  = "erp.InquiryFeedbackBeforeCreate"
	InquiryFeedbackEventBeforeUpdate  = "erp.InquiryFeedbackBeforeUpdate"
	InquiryFeedbackEventBeforeSave    = "erp.InquiryFeedbackBeforeCreate erp.InquiryFeedbackBeforeUpdate"
	InquiryFeedbackEventAfterCreate   = "erp.InquiryFeedbackAfterCreate"
	InquiryFeedbackEventAfterUpdate   = "erp.InquiryFeedbackAfterUpdate"
	InquiryFeedbackEventAfterSave     = "erp.InquiryFeedbackAfterCreate erp.InquiryFeedbackAfterUpdate"
	InquiryFeedbackEventDelete        = "erp.InquiryFeedbackDelete"
	InquiryFeedbackAccessControlEvent = "erp.InquiryFeedbackAccessControl"
)

func GetInquiryFeedbackConfig() *mgo.DocConfig {
	return InquiryFeedback_Config
}

var InquiryFeedback_Config *mgo.DocConfig

func init() {
	InquiryFeedback_Config = NewInquiryFeedbackConfig()
}
func NewInquiryFeedbackConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "erp.InquiryFeedback",
		Fields: []string{
			"sn", "title", "seller", "sellerName", "payType", "deliverAt", "deliver", "contactEmp", "contact", "contactPhone", "status", "isCancel", "isClose", "isConfirm", "confirmAt", "formAt", "formEmp", "createEmp", "note", "product",
		},
		RelationFields: []string{
			"seller", "payType", "contactEmp", "status", "formEmp", "createEmp", "product",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"seller": {
				Config:     GetSellerConfig,
				DocName:    "Seller",
				JoinType:   "O",
				KeyInside:  "sellerId",
				KeyOutSide: "id",
			},
			"payType": {
				Config:     GetPayTypeConfig,
				DocName:    "PayType",
				JoinType:   "O",
				KeyInside:  "payTypeId",
				KeyOutSide: "id",
			},
			"contactEmp": {
				Config:     GetEmpConfig,
				DocName:    "Emp",
				JoinType:   "O",
				KeyInside:  "contactEmpId",
				KeyOutSide: "id",
			},
			"status": {
				Config:     GetInquiryStatusConfig,
				DocName:    "InquiryStatus",
				JoinType:   "O",
				KeyInside:  "statusId",
				KeyOutSide: "id",
			},
			"formEmp": {
				Config:     GetEmpConfig,
				DocName:    "Emp",
				JoinType:   "O",
				KeyInside:  "formEmpId",
				KeyOutSide: "id",
			},
			"createEmp": {
				Config:     GetEmpConfig,
				DocName:    "Emp",
				JoinType:   "O",
				KeyInside:  "createEmpId",
				KeyOutSide: "id",
			},
			"product": {
				Config:     GetInquiryFeedbackProductConfig,
				DocName:    "InquiryFeedbackProduct",
				JoinType:   "M",
				KeyInside:  "id",
				KeyOutSide: "belongToId",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
